import { Injectable } from '@angular/core';
import { Resolve,ActivatedRouteSnapshot,RouterStateSnapshot } from '@angular/router';
import { Observable,of } from 'rxjs';
import { map, take,catchError }  from 'rxjs/operators';
import { HttpClient, HttpHeaders } from "@angular/common/http";
import { AuthTokenService } from '@services/auth-token.service';
import { CommonResponse,ToastColor,CommonService } from '@services/common-service.service';


@Injectable()
export class DeductionOrderResolver implements Resolve<Object> {
    constructor(private http:HttpClient,
        private authTokenService:AuthTokenService,
        private commonService:CommonService) {

    }

    resolve( route: ActivatedRouteSnapshot,state: RouterStateSnapshot): Observable<any>|Promise<any>|any {
        let url = '/scm/app/getDeductionOrderList.do';  
        let request = {
            "appUserId":'123'
        };
        return this.http.post(url,request).pipe(
            catchError(error=>{
                return of(error);
            })
        );
    }

}